package top.juntech.msweatherdata.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.juntech.msweatherdata.service.WeatherDataService;
import top.juntech.msweatherdata.vo.WeatherResponse;

@RestController
@RequestMapping("/weather")
public class WeatherDataController {
    @Autowired
    private WeatherDataService weatherDataService;

    @GetMapping("/cityId/{cityId}")
    public WeatherResponse getDataByCityId(@PathVariable("cityId")String cityId){
        return weatherDataService.getWeatherDataByCityId(cityId);
    }


    @GetMapping("/cityName/{cityName}")
    public WeatherResponse getDataByCityName(@PathVariable("cityName")String cityName){
        return weatherDataService.getWeatherDataByCityName(cityName);
    }
}
